package com.test.card.exception;

import com.test.card.enums.ApiResponseEnum;
import lombok.Data;

@Data
public class CardException extends RuntimeException {
    private Integer code;

    private String msg;

    private Integer httpStatus;

    public CardException(ApiResponseEnum apiResponseEnum){
        super(apiResponseEnum.getMessage());
        this.code = apiResponseEnum.getCode();
        this.msg = apiResponseEnum.getMessage();
        this.httpStatus = apiResponseEnum.getHttpStatus();
    }

    public CardException(Integer code, String msg, Integer httpStatus) {
        super(msg);
        this.code = code;
        this.msg = msg;
        this.httpStatus = httpStatus;
    }

    public CardException(String msg) {
        super(msg);
        this.msg = msg;
        this.code = -1;
        this.httpStatus = 200;
    }
}
